<?php

require_once 'models/DAL/LinhasDAO.php';

class Application_Model_DbTable_Linhas extends Zend_Db_Table_Abstract {

    protected $_name = 'Linha';
    protected $_primary = 'idLinha';

    public function __construct($config = array()) {
        parent::__construct($config);
    }

    public function getAllLinhas() {

        $rows = $this->fetchAll()->toArray();
        $return = array();

        foreach ($rows as $row) {
            $dao = new Application_Model_DAO_Linhas();
            $dao->setIdLinha($row['idLinha']);
            $dao->setNome($row['nome']);
            $dao->setImagePath($row['imagePath']);
            $return[] = $dao;
        }

        return $return;
    }

    public function getAllLinhasById($id) {

        $rows = $this->fetchAll();
        $return = array();

        foreach ($rows as $row) {
            $dao = new Application_Model_DAO_Linhas();
            $dao->setIdLinha($row['idLinha']);
            $dao->setNome($row['nome']);
            $dao->setImagePath($row['imagePath']);
            $return[] = $dao;
        }

        return $return;
    }

}

